#!/bin/sh

set -eu


if [ -n "${CARCH:-}" ] || \
   CARCH="$(${APK:-apk} --print-arch 2> "/dev/null")"; then
	for _klibcso in "/lib/klibc-"*".so"; do
		if [ -L "${_klibcso}" ] && \
		   _klibclink="$(readlink "${_klibcso}")" && \
		   [ ! -e "${_klibclink:-}" ]; then
			unlink "${_klibcso}"
		fi
	done
fi

exit 0
